import torch
from torch import nn


class Shit(nn.Module):
    def __init__(self):
        super(Shit, self).__init__()
        self.cos = nn.Linear(5, 2)

class Attention(nn.Module):
    def __init__(self):
        print(1)
        super(Attention, self).__init__()
        self.co1 = nn.Linear(5, 2)
        self.co2 = Shit()

x = Attention()
# 遍历模型的模块
for name, module in x.named_modules():
    print(f"Module Name: {name}")
    print(f"Module: {module}")

# # 遍历模型的参数
# for name, param in x.named_parameters():
#     print(f"Parameter Name: {name}")
#     print(f"Parameter: {param}")


signatures = inspect.signature(model_class.__init__)
all_params = [param.name for param in signatures.parameters.values()]


